//
//  UILabel+Extension.swift
//  weibo
//
//  Created by 陈伟 on 15/10/19.
//  Copyright © 2015年 陈伟. All rights reserved.
//

import UIKit

extension UILabel {
    
    convenience init(title:String ,fontsize: CGFloat = 14, color: UIColor = UIColor.darkGrayColor(), screenInset: CGFloat = 0 ){
        self.init()
        text = title
        textColor = color
        font = UIFont.systemFontOfSize(fontsize)
        numberOfLines = 0
        
        if screenInset == 0 {
            textAlignment = .Center
        }else{
            preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 2*screenInset
            textAlignment = .Left
        }
        sizeToFit()
    }
}
